import js from '@eslint/js';
import globals from 'globals';
import prettierRecommended from 'eslint-plugin-prettier/recommended';
import pluginVue from 'eslint-plugin-vue';
import stylisticJs from '@stylistic/eslint-plugin-js';

export default [
  js.configs.recommended,
  ...pluginVue.configs['flat/recommended'],
  prettierRecommended,
  {
    files: ['**/*.vue'],
    languageOptions: {
      parserOptions: {
        ecmaFeatures: {
          jsx: true,
        },
      },
    },
    rules: {
      'vue/multi-word-component-names': 'off', // 关闭组件的命名规则校验
      'vue/v-slot-style': 'off', // 关闭插槽的强制样式
      'vue/no-v-html': 'off', // 关闭使用v-html时的警告
    },
  },
  {
    files: ['**/*.{js,vue}'],
    languageOptions: {
      globals: {
        ...globals.browser,
      },
    },
    plugins: {
      '@stylistic/js': stylisticJs,
    },
    rules: {
      'no-console': 'warn',
      '@stylistic/js/spaced-comment': ['error', 'always'], // 注释中的 // 或 /* 后面紧跟着一个空格
    },
  },
];
